<template>
	<view class="content">
		<view class="index_log" v-if="isShwo">
			<view class="log">
				<image src="../../static/image/icon/预约.png" mode="" class="log_iamge"></image>3
				<view class="log_view">恭喜您预约成功</view>
			</view>
		</view>
		<image class="banner-image" src="../../static/image/index/yuyue.png"></image>
		<view>
			<view class="list-from">
				<view class="text">楼盘名称</view>
				<input class="input" focus placeholder="楼盘名称" v-model="parameter.name" />
			</view>
			<view class="list-from">
				<view class="text">预约类型</view>
				<picker @change="bindPickerChange" :value="index" :range="array">
					<view class="input">{{array[index]}}</view>
					<view class="input-fh"></view>
				</picker>
			</view>
			<view class="list-from">
				<view class="text2">门 户</view>
				<input class="input" focus placeholder="门户" v-model="parameter.model" />
			</view>
			
			<view class="list-from">
				<view class="text2">姓 名</view>
				<input class="input" focus placeholder="姓名" v-model="parameter.username" />
			</view>
			<view class="list-from">
				<view class="text">联系方式</view>
				<input class="input" focus placeholder="联系方式" v-model="parameter.telephone" />
			</view>
			<view class="list-from">
				<view class="text">微信号码</view>
				<input class="input" focus placeholder="微信号" v-model="parameter.wechat" />
			</view>
			<button class="button" @click="submit">
				<view class="text-button">确定预约</view>
			</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			const currentDate = this.getDate({
				format: true
			})
			return {
				title: 'picker',
				array: ['验房', '微改报价', '设计', '领包入住'],
				index: 0,
				isShwo: false,
				parameter: {
					"name": "",
					"type": 0,
					"model": "",
					"telephone": "",
					"wechat": "",
					"username": "",
					"user_id": "1"
				}
			}
		},
		methods: {
			bindPickerChange: function(e) {
				this.index = e.detail.value
				this.parameter.type =this.index
				
			},
			getDate(type) {

			},
			submit() {
				console.log(this.parameter);
				this.$http.post('/reserve/addReserveInfo', this.parameter).then(res => {
					console.log(res);
					if (res.data.code == 100002) {
						return
					}
					if (res.data.code == 200) {
						this.parameter.username=''
						this.parameter.wechat=''
						this.parameter.model=''
						this.parameter.type=''
						this.parameter.telephone=''
						this.parameter.name=''
						this.isShwo=true
						setTimeout(()=>{
							this.isShwo=false
						}, 1000)
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 100vw;
		height: 100vh;
		background-color: #F5F5F5;
		box-sizing: border-box; //盒子模型

		.index_log {
			position: fixed;
			width: 100%;
			height: 100vh;
			background: rgba(0, 0, 0, 0.5);
			z-index: 999; //平面高度
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;

			.log {
				width: 300rpx;
				height: 228rpx;
				background: #ffffff;
				border-radius: 16rpx;
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;

				.log_iamge {
					width: 136rpx;
					height: 136rpx;
				}

				.log_view {
					width: 196rpx;
					height: 40rpx;
					font-size: 28rpx;
					font-weight: 500;
					text-align: LEFT;
					color: #000000;
					line-height: 28rpx;
				}
			}
		}

		.banner-image {
			width: 100%;
			height: 450rpx;
		}

		.list-from {
			text-align: center;
			box-sizing: border-box;
			padding: 40rpx 72rpx 0rpx 40rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.input {
				width: 486rpx;
				height: 60rpx;
				background: #ffffff;
				border: 2rpx solid rgba(0, 0, 0, 0.10);
				border-radius: 8rpx
			}
		}

		.button {
			margin-top: 100rpx;
			width: 328rpx;
			height: 80rpx;
			background: #3d9c36;
			border-radius: 8rpx;

			.text-button {
				color: #ffffff;
			}
		}
	}
</style>
